package com.zcf.shiro.web.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhaochaofeng
 * @date 2020/6/17 13:28
 */
@ControllerAdvice
@Slf4j
public class MyExceptionHandler {

    /**
     * 权限认证失败
     * anon，authcBasic，authc，user是AuthenticationFilter
     * @param e
     * @return
     */
    @ExceptionHandler
    public String ErrorHandler(AuthorizationException e) {
        return "error/403";
    }

}
